package org.example.langchan4j.config;

import com.fasterxml.jackson.annotation.JsonCreator;
import dev.langchain4j.internal.Json;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;

import java.util.List;

public interface AiCodeHelperService {
    //    @SystemMessage("你好，你是变糙领域的小助手")// 不够优雅
    @SystemMessage(fromResource = "system-prompt.txt")
    String chat(@MemoryId String memoryId, @UserMessage String userMessage);

    @SystemMessage(fromResource = "system-prompt1.txt")
    Report chatForReport1(PPTOutlineRequest request);

    // 学习报告 - content 字段必须包含完整的 Markdown 格式文本，包括 ##、###、- 等标记
    record Report(String content, ReportStructure structure){}

    record ReportStructure(String title, List<ReportSection1> sections){}

    record ReportSection1(String subtitle, List<String> items){}
    
    record PPTOutlineRequest(String content, String language, String model, boolean stream){}

    @SystemMessage(fromResource = "system-prompt2.txt")
    Report1 chatForReport2(String userMessage);

    record Report1(String name, List<ReportSection> sections) {
        @com.fasterxml.jackson.annotation.JsonCreator(mode = JsonCreator.Mode.DELEGATING)
        public static Report1 fromSections(List<ReportSection> sections) {
            return new Report1(null, sections);
        }
    }
    
    record ReportSection(String type, ReportData data){}
    
    record ReportData(
        String title, 
        String text, 
        List<ReportItem> items
    ){}
    
    record ReportItem(String title, String text) {
        @com.fasterxml.jackson.annotation.JsonCreator
        public ReportItem(String value) {
            this(value, null);
        }
    }
}
